package controller;

import java.util.List;

import model.*;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import util.HibernateUtil;


public class KlsEstadoVehiculoManager {

	
public List<KlsEstadoVehiculo> list() {
	        
	        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
	        session.beginTransaction();
	        List<KlsEstadoVehiculo> estadoVehiculo = null;
	        try {
	             
	            estadoVehiculo = session.createQuery("from KlsEstadoVehiculo").list();
	             
	        } 
	        catch (HibernateException e) {
	            e.printStackTrace();
	            session.getTransaction().rollback();
	        
	        }
	        session.getTransaction().commit();
	        return estadoVehiculo;
	    }
		
		
	    public KlsEstadoVehiculo load(int idEstadoVehiculo) {
	        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
	        session.beginTransaction();
	        KlsEstadoVehiculo KlsEstadoVehiculo = (KlsEstadoVehiculo) session.get(KlsEstadoVehiculo.class, idEstadoVehiculo); 
	        session.getTransaction().commit();
	        return KlsEstadoVehiculo;
	    }

}


